home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: Henry Cross <hcross@ix.netcom.com>
- Newsgroups: comp.lang.c
- Subject: Re: Can anyone optimize this VERY simple piece of code?
- Date: Tue, 20 Feb 1996 18:41:03 -0800
- Organization: i586 Box @Irvine, Ca.
- Message-ID: <312A863F.49FC@ix.netcom.com>
- References: <19950700wnr@samtech.demon.co.uk> <31276E30.26C0@ix.netcom.com> <824842585snz@genesis.demon.co.uk>
- NNTP-Posting-Host: irv-ca14-13.ix.netcom.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-NETCOM-Date: Tue Feb 20 6:40:11 PM PST 1996
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- Lawrence Kirby wrote:
- >
- > In article <31276E30.26C0@ix.netcom.com>
- > hcross@ix.netcom.com "Henry Cross" writes:
- >
- > >> Personally I'd use a VERY simple language. Assembly!
- > > This is a job for inline assembly, compiler allowing, or an assembler
- > >if not.
- > > However if you must persist in C, use pointers every place possible.
- >
- > This hasn't been the case in any reasonable compiler for a number of years
- > now.
- >
- > > For example vgamem[count] could be a pointer that incremented++ vice
- > > an index to an array. (Which is very expensive computationally.)
- >
- > The strength reduction required to convert an index to a pointer is one
- > of the simpler optimistaion that compilers perform. Code that uses indices
- > often provides more information to the compiler for optimisation purposes so
- > may even result in better code generated.
-
- Your mileage may vary, according to compiler. The only certain solution
- would be to examine the code generated by the compiler with the
- appropriate options turned on.
-
- regards,
- H.Cross
-